#-------------------------------------------------------------------
# This file is part of the CMake build system for ogre-7z 
# (7zip (LZMA) archives support for Ogre 3D)
#-------------------------------------------------------------------

project (Plugin_Ogre7z)

# define header files for the library
set (HEADER_FILES
	include/Ogre7zArchive.h
	include/Ogre7zArchiveFactory.h
	include/Ogre7zCommon.h
	include/Ogre7zFile.h
	include/Ogre7zPlugin.h
	include/Ogre7zPrerequisites.h
)

# define source files for the library
set (SOURCE_FILES
	src/Ogre7zArchive.cpp
	src/Ogre7zArchiveFactory.cpp
	src/Ogre7zCommon.cpp
	src/Ogre7zFile.cpp
	src/Ogre7zPlugin.cpp
	src/Ogre7zPluginDll.cpp
)

# setup project include directory
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include)

# setup 7zip include directiry
if (SETUP_USE_BUILTIN_7ZIP_LIBRARY)
	include_directories (${CMAKE_HOME_DIRECTORY}/support/7zlib/common)
else (SETUP_USE_BUILTIN_7ZIP_LIBRARY)
	include_directories (${7ZIP_INCLUDE_DIR})
endif (SETUP_USE_BUILTIN_7ZIP_LIBRARY)
# boost
if (BOOST_IS_REQUIRED)
	include_directories (${Boost_INCLUDE_DIRS})
endif (BOOST_IS_REQUIRED)
# ogre
include_directories (${OGRE_INCLUDE_DIRS})
include_directories (${OGRE_CONFIG_INCLUDE_DIRS})


# setup link directories 
# boost
if (BOOST_IS_REQUIRED)
	link_directories (${Boost_LIBRARY_DIRS})
endif (BOOST_IS_REQUIRED)

# setup Ogre7z target
add_library (Plugin_Ogre7z SHARED ${HEADER_FILES} ${SOURCE_FILES})

# setup link libraries
target_link_libraries (Plugin_Ogre7z ${OGRE_LIBRARIES})

if (NOT SETUP_USE_BUILTIN_7ZIP_LIBRARY)
	target_link_libraries (Plugin_Ogre7z debug ${7ZIP_LIBRARY_DBG} optimized ${7ZIP_LIBRARY_FWK} ${7ZIP_LIBRARY_REL})
else (NOT SETUP_USE_BUILTIN_7ZIP_LIBRARY)
	target_link_libraries (Plugin_Ogre7z Ogre-7ziplib)
endif (NOT SETUP_USE_BUILTIN_7ZIP_LIBRARY)

# boost
if (BOOST_IS_REQUIRED)
	target_link_libraries (Plugin_Ogre7z ${Boost_THREAD_LIBRARY} ${Boost_DATE_TIME_LIBRARY})
endif (BOOST_IS_REQUIRED)


# setup project dependencies
if (NOT SETUP_USE_BUILTIN_7ZIP_LIBRARY)
	add_dependencies(Plugin_Ogre7z Ogre-7ziplib)
endif (NOT SETUP_USE_BUILTIN_7ZIP_LIBRARY)
